package autopeople.tools;

import java.io.File;

import javax.inject.Named;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;

import org.apache.log4j.Logger;

@Named
public final class ResourceTool {
	protected static Logger logger = Logger.getLogger("controller");

	public Source getSourceFile(String fileName) {
		return new StreamSource(getFile(fileName));
	}

	public File getFile(String fileName) {
		logger.debug("Getting file from filename " + fileName);
		final String filePath = getClass().getResource(fileName).getFile();
		logger.debug("Absolute file path is " + filePath);
		return new File(filePath);
	}

}
